package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.MallCate;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MallCateMapper extends MyMapper<MallCate> {

    @Select("select t.order from t_mall_cate t where id=#{orderId}")
    Integer findMallCateOrderId(@Param("orderId") Integer orderId);

    List<MallCate> findByMallCate(@Param("mallCate") MallCate mallCate); //显示商场品类

    List<MallCate> findShowByMallCate(@Param("mallCate") MallCate mallCate); //显示商场品类（全）

    List<MallCate> finByMallCateHide(@Param("mallCate") MallCate mallCate); //隐藏商场品类

    List<MallCate> findeMallCateTop(@Param("mallCate") MallCate mallCate);

    List<MallCate> findByGroupMallCate();//显示基本品类

    void addMallCate(MallCate mallCate);

    Integer findMallCateStatusById(@Param("id") Integer id);

    List<MallCate> findMainCateNameList(@Param("id") Integer id);

    void updateMallCateStatusById(@Param("id") Integer id, @Param("status") Integer status);

    void updateMallCateStatusById0(@Param("id") Integer id, @Param("status") Integer status);

    @Select("select * from t_mall_cate where id=#{id}")
    MallCate findMallCateById(@Param("id") Integer id);

    @Select("SELECT MAX(t.order)  FROM t_mall_cate t WHERE t.order <> -1")
    Integer findMallCateMax();

    Integer updateMallCateAddOne(@Param("order") Integer order, @Param("orderId") Integer orderId, @Param("mallCode") String mallCode);

    Integer updateMallCateReduceOne(@Param("order") Integer order, @Param("orderId") Integer orderId, @Param("mallCode") String mallCode);

    Integer updateMallCateOrder(@Param("id") Integer id, @Param("order") Integer order, @Param("mallCode") String mallCode);

    @Select("SELECT t.order FROM t_mall_cate t WHERE t.mall_code=#{mallCode} and t.status=0 and t.order <> -1 order by t.order ASC")
    List<MallCate> allMallCate(@Param("mallCode") String mallCode);

    List<MallCate> listMallCate(@Param("mallCode") String mallCode);
}
